using Microsoft.Xna.Framework;

public class HMFrameCounter : DrawableGameComponent {
    private float seconds;
    private float frames;

    public HMFrameCounter(Game game) : base(game) {}

    public override void Draw(GameTime gameTime) {
        seconds += (float)gameTime.ElapsedRealTime.TotalSeconds;
        frames++;

        if (seconds >= 0.5f) {
            Game.Window.Title = "FPS: " + frames/seconds;

            frames = 0;
            seconds = 0;
        }
    }
}